<?php
require_once 'libraries/utilites/funtion.php';
$path = "data/films.txt";
$films = mreadFile($path);
?>
<form method="POST" action="fedit.php"> 
    <?php
    foreach ($films as $item) {
        $loc = trim($item, '\n\t\r');
        $rating3 = explode(";", $loc);
        if ($_GET["if"] == $rating3[0]) {
            ?>
            <img src = 'public/images/films/<?php if (!empty($rating3[1])) echo $rating3[1] ?>'/> </br>
            Film Name   :<input type="text" name="name" value="<?php if (!empty($rating3[2])) echo $rating3[2] ?>"> </br>
            Rating   :<input type="text" name="name" value="<?php if (!empty($rating3[3])) echo $rating3[3] ?>"> </br>
            Comment: <textarea name="comment" rows="6" cols="35"></textarea></br>
            <input type="submit" name="submit" value="Submit">
            <?php echo '<a href="file.php">Back<br></a>'; ?>
            <?php
        }
    }
    ?>
</form>